package com.haina.shop.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.haina.shop.domain.Area;
import com.haina.shop.domain.UserAddr;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
* @author 48077
* @description 针对表【tz_user_addr(用户配送地址)】的数据库操作Mapper
* @createDate 2024-07-31 18:34:30
* @Entity com.haina.shop.domain.UserAddr
*/
public interface UserAddrMapper extends BaseMapper<UserAddr> {

    int insert(UserAddr addrParam);

    @Update("update tz_user_addr set common_addr = 0")
    int updCommonAddrAll();

    @Update("update tz_user_addr set common_addr = 1 where addr_id = #{param}")
    int updCommonAddr(int addrId);

    @Select("select * from tz_user_addr where addr_id = #{param}")
    UserAddr selByAddrId(int addrId);

    int updateAddr(UserAddr addrParam);

    @Delete("delete from tz_user_addr where addr_id=#{param}")
    int deleteAddr(int addrId);
    @Select("select * from tz_user_addr where user_id=#{userId} and common_addr=#{common}")
    UserAddr selectAddr(@Param("userId") Long userId, @Param("common") int common);
}




